package com.wl.application.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wl.application.entity.Emp;
import com.wl.application.service.EmpService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wl
 * @version 1.0
 * @date 2022/6/14
 * @description:
 */
@Controller
public class AllController {


    @Autowired
    private EmpService empService;

    @RequestMapping("/aa/{curr}/{size}")
    public String getAll(ModelMap map, @PathVariable("curr") Integer curr, @PathVariable("size") Integer size){
        //创建分页对象
        Page<Emp> page=new Page<>();
        page.setCurrent(curr);
        page.setSize(size);
        Page<Emp> page1 = empService.page(page);
        map.addAttribute("empList",page1);
        return "index";
    }
}
